package com.zhiyou.service.impl;

import com.zhiyou.dao.UserMapper;
import com.zhiyou.entity.User;
import com.zhiyou.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@SuppressWarnings("all")
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;
    public  List<User> getAll() {
        List<User> list = userMapper.selectAll();
        return list;
    }

    @Override
    public User login(String username) {
        User user = new User();
        user.setuUsername(username);
        User user1 = userMapper.selectOne(user);
        return user1;
    }

    @Override
    public void register(User user) {
        user.setuStatus(1);
        int rows = userMapper.insert(user);
    }
}
